package com.hu.controller;

import com.hu.entity.GetUniversity;
import com.hu.entity.ShowContent;
import com.hu.service.UniversityService;
import com.hu.vo.UniversityVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author ZhouKai
 * 2022/4/20 16:09
 */
@RestController
public class UniversityController {
    @Autowired
    UniversityService universityService;

    /**
     * 获取院校信息
     *
     * @param name 院校名称
     * @return Json 院校信息
     */
    @RequestMapping("/getUniversity")
    public UniversityVo getUniversityVo(@RequestBody GetUniversity name) {
        System.out.println("schoolName:" + name);
        return universityService.getUniversity(name.getName());
    }

    /**
     * 用于利用ajax更改学校生活界面信息
     *
     * @param showContent 选项id
     * @return id
     */
    @RequestMapping("/showContent")
    public Integer showContent(ShowContent showContent) {
        return showContent.getIdx();
    }
}
